using System;
using System.ComponentModel;
using MammothMicro.SilverSocket.Protocol.System;
using MammothMicro.SilverSocket.Shared;
using SilverSocket.Shared;


namespace MammothMicro.SilverSocket.Client
{
    /// <summary>
    /// Message from client
    /// </summary>
    public interface IMessageClient
    {
        /// <summary>
        /// Occurs when client has connected to message server
        /// </summary>
        event EventHandler<AsyncCompletedEventArgs> ConnectCompleted;

        /// <summary>
        /// Occurs when message is sent
        /// </summary>
        event EventHandler<AsyncCompletedEventArgs> SendCompleted;

        /// <summary>
        /// Occurs if connection with message server has been lost.
        /// </summary>
        event EventHandler<EventArgs> ConnectionLost;

        /// <summary>
        /// Occurs when new message have been received.
        /// </summary>
        event EventHandler<MessageReceivedEventArgs> MessageRecieved;

        /// <summary>
        /// Indicates if client is connected to message server.
        /// </summary>
        bool Connected { get; }

        /// <summary>
        /// Connect to message server async.
        /// </summary>
        void ConnectAsync();

        /// <summary>
        /// Disconnects from message server.
        /// </summary>
        void Disconnect();

        /// <summary>
        /// Connect to message server async.
        /// </summary>
        /// <param name="state">
        /// </param>
        void ConnectAsync(object state);

        /// <summary>
        /// Send message.
        /// </summary>
        /// <param name="message">
        /// </param>
        void SendMessageAsync(DuplexMessage message);

        /// <summary>
        /// Send message.
        /// </summary>
        /// <param name="message">
        /// </param>
        /// <param name="userState">
        /// </param>
        // void SendMessageAsync(DuplexCbMessage message, object userState);
    }
}